/**
 * 
 */
package handwritten.character;

import java.util.Hashtable;


/**
 * @author Louis
 *
 */
class CharacterCollectionFactory {
	
	private static CharacterCollectionFactory instance = null;
	
	private Hashtable<Class<? extends HandWritten>,CharacterCollection<?>> collections;
	
	public static CharacterCollectionFactory getInstance(){
		if(instance == null)
			instance = new CharacterCollectionFactory();
		return instance;
	}
	
	private CharacterCollectionFactory(){
		collections = new Hashtable<Class<? extends HandWritten>,CharacterCollection<?>>();
		collections.put(HandWrittenCharacter.class, new CharacterCollection<HandWrittenCharacter>(HandWrittenCharacter.class));
		collections.put(RawHandWrittenCharacter.class, new CharacterCollection<RawHandWrittenCharacter>(RawHandWrittenCharacter.class));
		collections.put(ModifiedHWCharacter.class, new CharacterCollection<ModifiedHWCharacter>(ModifiedHWCharacter.class));
		
	}
	
	public CharacterCollection<?> createCollection(Class<? extends HandWritten> key){
		return collections.get(key).createCollection();
	}
	public CharacterCollection<?> createCollection(Class<? extends HandWritten> key,String name){
		return collections.get(key).createCollection(name);
	}
	
}
